package dynamicProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Collections;

public class StaticMethodProxy implements InvocationHandler {

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		System.out.println("call before " + method.toGenericString());
		Object ret = method.invoke(null, args);
		System.out.println("call after " + method.toString());
		return ret;
	}

	static Object newInst(Class<?> z) {
		return Proxy.newProxyInstance(z.getClassLoader(), z.getInterfaces(), new StaticMethodProxy());
	}

	static String hello() {
		return "-hello-";
	}

	public static void main(String[] args) {
	}
}
